import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

public class sageDong {

        public static void main(String[] args) {
            // 获取当前时间
            LocalDateTime now = LocalDateTime.now();
            int year = now.getYear() % 100;
            int month = now.getMonthValue();
            int day = now.getDayOfMonth();
            int hour = now.getHour();

            // 将 24 小时制转换为 12 小时制
            if (hour == 0) {
                hour = 12;
            } else if (hour > 12) {
                hour -= 12;
            }

            // 计算上卦和下卦
            int upperGua = (year + month + day) % 8;
            int lowerGua = (year + month + day + hour) % 8;

            if (upperGua == 0) {
                upperGua = 8;
            }
            if (lowerGua == 0) {
                lowerGua = 8;
            }

            // 计算动爻
            int movingYao = (year + month + day + hour) % 6;
            if (movingYao == 0) {
                movingYao = 6;
            }

            // 八卦对应表
            Map<Integer, String> guaDict = new HashMap<>();
            guaDict.put(1, "乾");
            guaDict.put(2, "兑");
            guaDict.put(3, "离");
            guaDict.put(4, "震");
            guaDict.put(5, "巽");
            guaDict.put(6, "坎");
            guaDict.put(7, "艮");
            guaDict.put(8, "坤");

            // 输出卦象和动爻
            System.out.println("今日日期: " + year + "年" + month + "月" + day + "日 " + hour + "时");
            System.out.println("今日卦象:");
            System.out.println("上卦: " + guaDict.get(upperGua));
            System.out.println("下卦: " + guaDict.get(lowerGua));
            System.out.println("动爻: 第" + movingYao + "爻");
        }
    }

